1. Приведение данных к единому виду

Ammon_1996_clean <- Ammon_1996 %>% 
  mutate(case = paste(subject_id, occasion, sep = "-")) %>% 
  mutate(route = route %>% str_remove_all(" infusion")) %>% 
  rename(infusion_duration_min = duration_inf_min)
rm(Ammon_1996)
Jones_1984_clean <- Jones_1984 %>% 
  mutate(subject_id = paste("J", subject_id, sep = "-"),
         sex = case_when(sex == "male" ~ "M",
                         sex == "female" ~ "F"))
rm(Jones_1984)
Yelland_2008_clean <- Yelland_2008 %>% 
  mutate(case = paste(subject_id, occasion, sep = "-"))
rm(Yelland_2008)
Emberger_2023_clean <- Emberger_2023 %>% 
  filter(!is.na(conc_g_per_L)) %>% 
  rename(wt_kg = WT_kg,
         sex = Sex,
         age = Age,
         bh_cm = BH_cm,
         bmi = BMI) %>% 
  mutate(subject_id = str_c("TE", "-", subject_id))
rm(Emberger_2023)
Wilkinson_IV_clean <- Wilkinson_IV %>% 
  filter(!is.na(conc_g_per_L)) %>% 
  mutate(route = route %>% str_remove_all(" infusion")) %>% 
  rename(wt_kg = WT_kg,
         sex = Sex)
rm(Wilkinson_IV)
Wilkinson_PO_clean <- Wilkinson_PO %>% 
  filter(!is.na(conc_g_per_L)) %>% 
  mutate(case = paste(subject_id, occasion, sep = "-")) %>% 
  rename(wt_kg = WT_kg,
         sex = Sex,
         bh_cm = BH_cm,
         bsa_m2 = BSA_m2,
         age = Age)  
rm(Wilkinson_PO)
Vestal_1977_e_pk <- Vestal_1977_elderly %>% 
rename_with(tolower) %>% 
  rename(Cmax = cmax_mg_dl) %>% 
  mutate(Cmax = Cmax / 100,
         route = case_when(
           str_detect(str_to_lower(route), "iv") ~ "IV",
           str_detect(str_to_lower(route), "po") ~ "PO"),
         subject_id = str_c("V-E-", subject_id))
rm(Vestal_1977_elderly)
Vestal_1977_y_pk <- Vestal_1977_young %>% 
rename_with(tolower) %>% 
  rename(Cmax = cmax_mg_dl) %>% 
  mutate(Cmax = Cmax / 100,
         route = case_when(
           str_detect(str_to_lower(route), "iv") ~ "IV",
           str_detect(str_to_lower(route), "po") ~ "PO"),
         subject_id = str_c("V-Y-", subject_id))  
rm(Vestal_1977_young)

2. Графики по датасетам

2.1 Графики индивидуальных кривых

Ammon_1996_clean %>% 
  select(subject_id, conc_g_per_L, time_min, occasion) %>% 
  mutate(occasion = occasion %>% as.factor) %>% 
  ggplot(aes(color = occasion)) +
  geom_line(aes(x = time_min, y = conc_g_per_L, group = occasion), linewidth = 2) +
  facet_wrap(subject_id~.)+
  scale_x_continuous(breaks = seq(0, 420, by = 50))+
  scale_y_continuous(breaks = seq(0, 1, by = 0.25))+
    labs(title = "Зависимость концентрации от времени", subtitle = "Индивидуальные кривые для каждого субъекта", x = "Время, мин", y = "Концентрация, г/л", color = "Визит", caption = "Ammon-1996")+
  theme(legend.position = "top")

ggplot(Jones_1984_clean, aes(x = time_min, y = conc_g_per_L)) +
  geom_line(aes(group = subject_id)) +
  scale_y_continuous(breaks = seq(0, 1.4, 0.1)) +
  scale_x_continuous(breaks = seq(0, 420, 30)) +
  # coord_cartesian(xlim = c(60, 420)) +
  labs(title = "Зависимость концентрации от времени",
       subtitle = "Индивидуальные кривые для каждого субъекта",
       caption = "Jones-1984",
       x = "Время, мин",
       y = "Концентрация, г/л")

Yelland_2008_clean %>% 
  select(subject_id, conc_g_per_L, time_min, occasion) %>% 
  mutate(occasion = occasion %>% as.factor) %>% 
  ggplot(aes(color = occasion)) +
  geom_line(aes(x = time_min, y = conc_g_per_L, group = occasion), linewidth = 2) +
  facet_wrap(subject_id~.)+
  scale_x_continuous(breaks = seq(0, 420, by = 50))+
  scale_y_continuous(breaks = seq(0, 1, by = 0.25))+
    labs(title = "Зависимость концентрации от времени", subtitle = "Индивидуальные кривые для каждого субъекта", x = "Время, мин", y = "Концентрация, г/л", color = "Визит", caption = "Yelland-2008")+
  theme(legend.position = "top")

Emberger_2023_clean %>% 
  select(subject_id, conc_g_per_L, time_min) %>% 
  mutate(subject_id = subject_id %>% str_remove_all("TE-")) %>%
  ggplot(aes(color = subject_id)) +
  geom_line(aes(x = time_min, y = conc_g_per_L, group = subject_id), linewidth = 2) +
  scale_x_continuous(breaks = seq(0, 420, by = 50)) +
  scale_y_continuous(breaks = seq(0, 1, by = 0.25)) +
  scale_color_discrete(breaks = as.character(1:10)) +
    labs(title = "Зависимость концентрации от времени",
         subtitle = "Индивидуальные кривые для каждого субъекта", 
         x = "Время, мин", y = "Концентрация, г/л",
         color = "Субъект", 
         caption = "По данным Thierauf-Emberger-2023") +
  theme(legend.position = "top")

ggplot(Wilkinson_IV_clean, aes(x = time_min, y = conc_g_per_L)) +
  geom_line(aes(group = subject_id)) +
  scale_y_continuous(breaks = seq(0, 1.4, 0.1)) +
  scale_x_continuous(breaks = seq(0, 510, 30)) +
  # coord_cartesian(xlim = c(60, 420)) +
  labs(title = "Зависимость концентрации от времени",
       subtitle = "Индивидуальные кривые для каждого субъекта",
       caption = "Wilkinson-1976-IV",
       x = "Время, мин",
       y = "Концентрация, г/л")

Wilkinson_PO_clean %>%
  select(subject_id, conc_g_per_L, time_min, occasion) %>% 
  mutate(occasion = occasion %>% as.factor) %>% 
  ggplot(aes(color = occasion)) +
  geom_line(aes(x = time_min, y = conc_g_per_L, group = occasion), linewidth = 2) +
  facet_wrap(subject_id~.)+
  scale_x_continuous(breaks = seq(0, 420, by = 50))+
  scale_y_continuous(breaks = seq(0, 1, by = 0.25))+
    labs(title = "Зависимость концентрации от времени", subtitle = "Индивидуальные кривые для каждого субъекта", x = "Время, мин", y = "Концентрация, г/л", color = "Визит", caption = "По данным Wilkinson-1976-PO")+
  geom_hline(aes(yintercept = 0.2)) +
  theme(legend.position = "top")

2.2 Среднеее и стандартное отклонение концентрации по времени

Время усреднено

Ammon_1996_clean %>% 
  group_by(case) %>%
  mutate(point_id = row_number() %>% as.factor) %>% 
  ungroup() %>%
  mutate(occasion = occasion %>% as.factor) %>% 
  group_by(occasion, point_id) %>% 
  summarise(conc_avg = mean(conc_g_per_L), conc_max = mean(conc_g_per_L) + sd(conc_g_per_L), conc_min = mean(conc_g_per_L) - sd(conc_g_per_L), time_min_avg = mean(time_min)) %>% 
  ungroup() %>% 
  ggplot() +
  geom_line(aes(x = time_min_avg, y = conc_avg, group = occasion, color = occasion)) +
  geom_errorbar(aes(x = time_min_avg, ymin = conc_min, ymax = conc_max), width = 6, linewidth = 0.5) +
  scale_x_continuous(breaks = seq(0, 400, by = 50)) +
  scale_y_continuous(breaks = seq(0, 1, by = 0.25)) +    
  labs(title = "Зависимость концентрации от времени",
       subtitle = "Mean ± SD",
       x = "Время, мин",
       y = "Концентрация, г/л",
       color = "Визит",
       caption = "По данным Ammon-1996")

Jones_1984_clean %>% 
  group_by(subject_id) %>%
  mutate(point_id = row_number() %>% as.factor) %>% 
  ungroup() %>% 
  group_by(point_id) %>% 
  summarise(conc_avg = mean(conc_g_per_L), conc_max = mean(conc_g_per_L) + sd(conc_g_per_L), conc_min = mean(conc_g_per_L) - sd(conc_g_per_L), time_min_avg = mean(time_min)) %>% 
  ggplot() +
  geom_line(aes(x = time_min_avg, y = conc_avg)) +
  geom_errorbar(aes(x = time_min_avg, ymin = conc_min, ymax = conc_max), width = 6, linewidth = 0.5) +
  scale_x_continuous(breaks = seq(0, 400, by = 50)) +
  scale_y_continuous(breaks = seq(0, 1, by = 0.25)) +    
  labs(title = "Зависимость концентрации от времени",
       subtitle = "Mean ± SD",
       x = "Время, мин",
       y = "Концентрация, г/л",
       caption = "По данным Jones-1984")

Yelland_2008_clean %>%
  group_by(case) %>%
  mutate(point_id = row_number() %>% as.factor) %>% 
  ungroup() %>%
  mutate(occasion = occasion %>% as.factor) %>% 
  group_by(occasion, point_id) %>% 
  summarise(conc_avg = mean(conc_g_per_L), conc_max = mean(conc_g_per_L) + sd(conc_g_per_L), conc_min = mean(conc_g_per_L) - sd(conc_g_per_L), time_min_avg = mean(time_min)) %>% 
  ungroup() %>% 
  ggplot() +
  geom_line(aes(x = time_min_avg, y = conc_avg, group = occasion, color = occasion)) +
  geom_errorbar(aes(x = time_min_avg, ymin = conc_min, ymax = conc_max), width = 6, linewidth = 0.5) +
  scale_x_continuous(breaks = seq(0, 400, by = 50)) +
  scale_y_continuous(breaks = seq(0, 1, by = 0.25)) +    
  labs(title = "Зависимость концентрации от времени",
       subtitle = "Mean ± SD",
       x = "Время, мин",
       y = "Концентрация, г/л",
       color = "Визит",
       caption = "По данным Yelland-2008")

Emberger_2023_clean %>% 
  group_by(subject_id) %>%
  mutate(point_id = row_number() %>% as.factor) %>% 
  ungroup() %>% 
  group_by(point_id) %>% 
  summarise(conc_avg = mean(conc_g_per_L), conc_max = mean(conc_g_per_L) + sd(conc_g_per_L), conc_min = mean(conc_g_per_L) - sd(conc_g_per_L), time_min_avg = mean(time_min)) %>% 
  ggplot() +
  geom_line(aes(x = time_min_avg, y = conc_avg)) +
  geom_errorbar(aes(x = time_min_avg, ymin = conc_min, ymax = conc_max), width = 6, linewidth = 0.5) +
  scale_x_continuous(breaks = seq(0, 400, by = 50)) +
  scale_y_continuous(breaks = seq(0, 1, by = 0.25)) +    
  labs(title = "Зависимость концентрации от времени",
       subtitle = "Mean ± SD",
       x = "Время, мин",
       y = "Концентрация, г/л",
       caption = "По данным Thierauf-Emberger-2023")

Wilkinson_IV_clean %>% 
  group_by(subject_id) %>%
  mutate(point_id = row_number() %>% as.factor) %>% 
  ungroup() %>% 
  group_by(point_id) %>% 
  summarise(conc_avg = mean(conc_g_per_L), conc_max = mean(conc_g_per_L) + sd(conc_g_per_L), conc_min = mean(conc_g_per_L) - sd(conc_g_per_L), time_min_avg = mean(time_min)) %>% 
  filter(as.numeric(point_id) < 27) %>% 
  ggplot() +
  geom_line(aes(x = time_min_avg, y = conc_avg)) +
  geom_errorbar(aes(x = time_min_avg, ymin = conc_min, ymax = conc_max), width = 6, linewidth = 0.5) +
  scale_x_continuous(breaks = seq(0, 400, by = 50)) +
  scale_y_continuous(breaks = seq(0, 1, by = 0.25)) +    
  labs(title = "Зависимость концентрации от времени",
       subtitle = "Mean ± SD",
       x = "Время, мин",
       y = "Концентрация, г/л",
       caption = "По данным Wilkinson-1976-IV")  

Wilkinson_PO_clean %>%
  group_by(case) %>%
  mutate(point_id = row_number() %>% as.factor) %>% 
  ungroup() %>% 
  group_by(point_id) %>% 
  summarise(conc_avg = mean(conc_g_per_L), conc_max = mean(conc_g_per_L) + sd(conc_g_per_L), conc_min = mean(conc_g_per_L) - sd(conc_g_per_L), time_min_avg = mean(time_min)) %>% 
  ggplot() +
  geom_line(aes(x = time_min_avg, y = conc_avg)) +
  geom_errorbar(aes(x = time_min_avg, ymin = conc_min, ymax = conc_max), width = 6, linewidth = 0.5) +
  scale_x_continuous(breaks = seq(0, 400, by = 50)) +
  scale_y_continuous(breaks = seq(0, 1, by = 0.25)) +    
  labs(title = "Зависимость концентрации от времени",
       subtitle = "Mean ± SD",
       x = "Время, мин",
       y = "Концентрация, г/л",
       caption = "По данным Wilkinson-1976-PO")  

3. Расчет ФК параметров для датасетов

#k - это насколько мы прибавляем к индексу tmax
pharma_fun <- function(conc, t, dose, k = 1) {
  # Моделирование для подсчёта beta, C0, Vd 0 порядка
  t_sample <- {{t}}[(first(which.max({{conc}})) + k):length({{t}})]
  conc_sample <- conc[(first(which.max({{conc}})) + k):length({{conc}})]
  dose <- first({{dose}})
  model <- lm(conc_sample ~ t_sample)
  Beta <- -as.numeric(model$coefficients[2])
  C_0_0_order <- as.numeric(model$coefficients[1])
  V_d_0_order <- dose / C_0_0_order
  
  # Моделирование для подсчёта kel, C0, Vd 1 порядка
  indexes <- conc_sample > 0
  model_1 <- lm(log(conc_sample[indexes]) ~ t_sample[indexes])
  Kel <- -as.numeric(model_1$coefficients[2])
  C_0_1_order <- exp(as.numeric(model_1$coefficients[1]))
  V_d_1_order <- dose / C_0_1_order
  
  # Подсчёт AUC0-t
  
  # if (length({{t}}) < 2) AUC <- NA
  # if (anyNA({{t}}) | anyNA({{conc}})) AUC <- NaN
  t0 = {{t}}[-length({{t}})]
  t1 = {{t}}[-1]
  c0 = {{conc}}[-length({{conc}})]
  c1 = {{conc}}[-1]
  AUC = sum(((c0 + c1)/2)*(t1 - t0))
  
  # Подсчёт Cmax
  cmax <- max(conc)
  
  # Подсчёт Tmax
  tmax <- t[first(which.max(conc))]
  return(list(Beta = Beta,
              Kel = Kel,
              C_0_0_order = C_0_0_order,
              V_d_0_order = V_d_0_order,
              C_0_1_order = C_0_1_order,
              V_d_1_order = V_d_1_order,
              AUC = AUC,
              Cmax = cmax,
              Tmax = tmax))
}

stat_ph <- list(
        "Среднее" = ~mean(., na.rm = TRUE) %>% round(4),
        "Медиана" = ~median(., na.rm = TRUE)%>% round(4),
        "Стандартное отклонение"   = ~sd(., na.rm = TRUE) %>% round(4),
        "Коэффициент вариации (CV), %" = ~round((sd(., na.rm = TRUE))/(mean(., na.rm = TRUE)) * 100, 2)
        )
Jones_1984_pk <- Jones_1984_clean %>% 
  arrange(time_min) %>% 
  nest(.by = subject_id, .key = "subject_data") %>% 
  mutate(pharma = purrr::map(subject_data,
                            ~pharma_fun(.$conc_g_per_L,
                                        .$time_min,
                                        .$dose_g_per_kg))) %>% 
  unnest_wider(col = pharma) %>% 
  select(-subject_data)

Jones_1984_pk <- Jones_1984_clean %>% 
  select(-c(time_min, conc_g_per_L)) %>% 
  group_by(subject_id) %>% 
  slice(1) %>% 
  ungroup() %>% 
  right_join(Jones_1984_pk)
## Joining with `by = join_by(subject_id)`
rm(Jones_1984_clean)
Ammon_1996_pk <- Ammon_1996_clean %>% 
  arrange(time_min) %>% 
  nest(.by = case, .key = "subject_data") %>% 
  mutate(pharma = purrr::map(subject_data,
                            ~pharma_fun(.$conc_g_per_L,
                                        .$time_min,
                                        .$dose_g_per_kg))) %>% 
  unnest_wider(col = pharma) %>% 
  select(-subject_data)

Ammon_1996_pk <- Ammon_1996_clean %>%
  select(-c(time_min, conc_g_per_L)) %>%
  group_by(case) %>%
  slice(1) %>%
  ungroup() %>%
  right_join(Ammon_1996_pk, by = join_by(case)) %>% 
  mutate(subject_id = str_c("A-IV-", subject_id)) %>% 
  select(-case)
rm(Ammon_1996_clean)
Yelland_2008_pk <- Yelland_2008_clean %>% 
  arrange(time_min) %>% 
  nest(.by = case, .key = "subject_data") %>% 
  mutate(pharma = purrr::map(subject_data,
                            ~pharma_fun(.$conc_g_per_L,
                                        .$time_min,
                                        .$dose_g_per_kg))) %>% 
  unnest_wider(col = pharma) %>%
  select(-subject_data)

Yelland_2008_pk <- Yelland_2008_clean %>%
  select(-c(time_min, conc_g_per_L)) %>%
  group_by(case) %>%
  slice(1) %>%
  ungroup() %>%
  right_join(Yelland_2008_pk, by = join_by(case)) %>%
  mutate(subject_id = str_c("Y-", subject_id)) %>% 
  select(-case)
rm(Yelland_2008_clean)
Emberger_2023_pk <- Emberger_2023_clean %>% 
  arrange(time_min) %>% 
  nest(.by = subject_id, .key = "subject_data") %>% 
  mutate(pharma = purrr::map(subject_data,
                            ~pharma_fun(.$conc_g_per_L,
                                        .$time_min,
                                        .$dose_g_per_kg))) %>% 
  unnest_wider(col = pharma) %>% 
  select(-subject_data)

Emberger_2023_pk <- Emberger_2023_clean %>% 
  select(-c(time_min, conc_g_per_L)) %>% 
  group_by(subject_id) %>% 
  slice(1) %>% 
  ungroup() %>% 
  right_join(Emberger_2023_pk)
## Joining with `by = join_by(subject_id)`
rm(Emberger_2023_clean)
Wilkinson_IV_pk <- Wilkinson_IV_clean %>% 
  arrange(time_min) %>% 
  nest(.by = subject_id, .key = "subject_data") %>% 
  mutate(pharma = purrr::map(subject_data,
                            ~pharma_fun(.$conc_g_per_L,
                                        .$time_min,
                                        .$dose_g_per_kg))) %>% 
  unnest_wider(col = pharma) %>% 
  select(-subject_data)

Wilkinson_IV_pk <- Wilkinson_IV_clean %>% 
  select(-c(time_min, conc_g_per_L)) %>% 
  group_by(subject_id) %>% 
  slice(1) %>% 
  ungroup() %>% 
  right_join(Wilkinson_IV_pk) %>% 
  mutate(subject_id = str_c("W-IV-", subject_id))
## Joining with `by = join_by(subject_id)`
rm(Wilkinson_IV_clean)
Wilkinson_PO_pk <- Wilkinson_PO_clean %>% 
  arrange(time_min) %>% 
  nest(.by = case, .key = "subject_data") %>% 
  mutate(pharma = purrr::map(subject_data,
                            ~pharma_fun(.$conc_g_per_L,
                                        .$time_min,
                                        .$dose_g_per_kg))) %>% 
  unnest_wider(col = pharma) %>% 
  select(-subject_data)

Wilkinson_PO_pk <- Wilkinson_PO_clean %>%
  select(-c(time_min, conc_g_per_L)) %>%
  group_by(case) %>%
  slice(1) %>%
  ungroup() %>%
  right_join(Wilkinson_PO_pk, by = join_by(case)) %>% 
  mutate(subject_id = str_c("W-PO-", subject_id)) %>% 
  select(-case)
rm(Wilkinson_PO_clean)

4. Объединение датасетов

main_df <- bind_rows(Ammon_1996_pk,
                     Emberger_2023_pk,
                     Jones_1984_pk,
                     Wilkinson_IV_pk,
                     Wilkinson_PO_pk,
                     Yelland_2008_pk,
                     Vestal_1977_e_pk,
                     Vestal_1977_y_pk)

main_df <- main_df %>% 
  mutate(across(c(where(is.character), occasion, infusion_duration_min, -subject_id), ~as.factor(.x)))
# Оставил только средние значения по визитам (независимость наблюдений соблюдена)
WILK <- main_df %>% 
  filter(study_id == "Wilkinson-1976-PO") %>% 
  arrange(desc(dose_g_per_kg), .by_group = TRUE) %>% 
  group_by(subject_id) %>% 
  slice(1)
order_0_df <- main_df %>%
  select(-c(Kel, contains("1_order"))) %>% 
  filter(study_id != "Wilkinson-1976-PO") %>%
  group_by(subject_id) %>% 
  mutate(across(c(Beta, C_0_0_order, V_d_0_order, AUC, Cmax, Tmax), ~mean(.x))) %>%
  slice(1) %>% 
  ungroup() %>% 
  select(-occasion) %>% 
  bind_rows(WILK)
# nrow(order_0_df)
# length(unique(order_0_df$subject_id))
order_1_df <- main_df %>% filter(dose_g_per_kg < 0.23)
main_df %>% 
  select(-subject_id) %>% 
  gtsummary::tbl_summary()
Characteristic N = 2061
study_id
    Ammon_1996 24 (12%)
    Jones_1984 48 (23%)
    Thierauf_Emberger_2023 10 (4.9%)
    Vestal-1977-elderly 25 (12%)
    Vestal-1977-young 25 (12%)
    Wilkinson-1976-IV 6 (2.9%)
    Wilkinson-1976-PO 32 (16%)
    Yelland_2008 36 (17%)
occasion
    1 32 (35%)
    2 32 (35%)
    3 20 (22%)
    4 8 (8.7%)
    Unknown 114
dose_g_per_kg 0.57 (0.52, 0.68)
route
    IV 80 (39%)
    PO 126 (61%)
infusion_duration_min
    60 74 (93%)
    120 6 (7.5%)
    Unknown 126
food
    fasted 136 (66%)
    fed 70 (34%)
site
    capillary 86 (42%)
    venous 120 (58%)
Beta 0.0022 (0.0019, 0.0026)
    Unknown 50
Kel 0.008 (0.006, 0.012)
    Unknown 50
C_0_0_order 0.93 (0.60, 1.00)
    Unknown 50
V_d_0_order 0.68 (0.60, 0.72)
    Unknown 50
C_0_1_order 1.64 (1.24, 2.15)
    Unknown 50
V_d_1_order 0.33 (0.24, 0.43)
    Unknown 50
AUC 142 (87, 196)
    Unknown 50
Cmax 0.85 (0.65, 1.20)
Tmax 60 (43, 75)
    Unknown 50
wt_kg 75 (71, 82)
    Unknown 108
sex
    F 5 (3.4%)
    M 141 (97%)
    Unknown 60
age 32 (23, 61)
    Unknown 114
bh_cm 178 (172, 179)
    Unknown 164
bmi 23.6 (22.3, 25.2)
    Unknown 196
bsa_m2 1.89 (1.83, 2.00)
    Unknown 124
lbm_kg 56 (51, 61)
    Unknown 156
1 n (%); Median (Q1, Q3)
1.  ФК-параметры (endpoints)
•   AUC, Cmax, 
•   C0_0, C0_1
•   Beta, Kel, 
•   Tmax
•   Vd_0,Vd_1
2. Условия эксперимента
•   Dose (g/kg)
•   Route (IV/PO)
•   Occasion (1/2/NA)
•   Food (fed/fasted)
•   Infusion_duration_min
•   Study_id
3.  Личные данные пациента
•   WT, BH, BMI, BSA, LBM
•   Sex, Age
main_df_long <- main_df %>% 
  select(where(is.numeric)) %>% 
  pivot_longer(
    cols = everything(),
    names_to = "variable",
    values_to = "value"
  )

ggplot(main_df_long, aes(x = value)) +
  geom_histogram(bins = 30) +
  facet_wrap(~ variable, scales = "free") +
  theme_bw() +
  labs(x = NULL, y = NULL)
## Warning: Removed 1262 rows containing non-finite outside the scale range
## (`stat_bin()`).

ggplot(main_df_long, aes(x = value)) +
  geom_density(na.rm = TRUE) +
  facet_wrap(~ variable, scales = "free") +
  theme_bw() +
  labs(x = NULL, y = NULL)

Можно прологорифмировать переменные с правосторонней ассиметрией Kel, V_d_o, V_d_1, C_0_1_order

main_df_fac_long <- main_df %>% 
  select(where(is.factor)) %>% 
  pivot_longer(
    cols = everything(),
    names_to = "variable",
    values_to = "value"
  )

ggplot(main_df_fac_long, aes(x = value)) +
  geom_bar() +
  facet_wrap(~ variable, scales = "free_x") +
  theme_bw() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  labs(x = NULL, y = NULL)

pk_num <- main_df %>% 
  select(where(is.numeric)) %>% 
  select(-lbm_kg, -bsa_m2, -bh_cm, -bmi) #лишние убрал


cor_mat <- cor(pk_num, use = "pairwise.complete.obs")

cor_mat %>% 
  ggcorr(., label = TRUE)

Проверяем гипотезу о различиях групп по категориям food и site

H0: mean (fasted) = mean(fed) H1: mean (fasted) != mean(fed)

t.test(log(AUC) ~ food, data = order_0_df) 
## 
##  Welch Two Sample t-test
## 
## data:  log(AUC) by food
## t = 9.009, df = 48.616, p-value = 6.134e-12
## alternative hypothesis: true difference in means between group fasted and group fed is not equal to 0
## 95 percent confidence interval:
##  0.4552847 0.7167806
## sample estimates:
## mean in group fasted    mean in group fed 
##             5.264317             4.678284
t.test(log(Cmax) ~ food, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  log(Cmax) by food
## t = 10.867, df = 84.518, p-value < 2.2e-16
## alternative hypothesis: true difference in means between group fasted and group fed is not equal to 0
## 95 percent confidence interval:
##  0.4542268 0.6576812
## sample estimates:
## mean in group fasted    mean in group fed 
##            0.1532168           -0.4027372
t.test(Tmax ~ food, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  Tmax by food
## t = -1.2786, df = 93.904, p-value = 0.2042
## alternative hypothesis: true difference in means between group fasted and group fed is not equal to 0
## 95 percent confidence interval:
##  -16.571704   3.589098
## sample estimates:
## mean in group fasted    mean in group fed 
##             62.70968             69.20098
t.test(Beta ~ food, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  Beta by food
## t = -0.18184, df = 39.468, p-value = 0.8566
## alternative hypothesis: true difference in means between group fasted and group fed is not equal to 0
## 95 percent confidence interval:
##  -0.0002730811  0.0002280155
## sample estimates:
## mean in group fasted    mean in group fed 
##          0.002169623          0.002192156
t.test(C_0_0_order ~ food, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  C_0_0_order by food
## t = 4.225, df = 37.009, p-value = 0.0001495
## alternative hypothesis: true difference in means between group fasted and group fed is not equal to 0
## 95 percent confidence interval:
##  0.09480385 0.26952408
## sample estimates:
## mean in group fasted    mean in group fed 
##            0.9811502            0.7989862
t.test(V_d_0_order ~ food, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  V_d_0_order by food
## t = 1.5073, df = 46.389, p-value = 0.1385
## alternative hypothesis: true difference in means between group fasted and group fed is not equal to 0
## 95 percent confidence interval:
##  -0.009793554  0.068237153
## sample estimates:
## mean in group fasted    mean in group fed 
##            0.6772378            0.6480160

H0: mean (capillary) = mean(venous) H1: mean (capillary) != mean(venous)

t.test(log(AUC) ~ site, data = order_0_df) 
## 
##  Welch Two Sample t-test
## 
## data:  log(AUC) by site
## t = 9.009, df = 48.616, p-value = 6.134e-12
## alternative hypothesis: true difference in means between group capillary and group venous is not equal to 0
## 95 percent confidence interval:
##  0.4552847 0.7167806
## sample estimates:
## mean in group capillary    mean in group venous 
##                5.264317                4.678284
t.test(log(Cmax) ~ site, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  log(Cmax) by site
## t = -4.4454, df = 112.65, p-value = 2.065e-05
## alternative hypothesis: true difference in means between group capillary and group venous is not equal to 0
## 95 percent confidence interval:
##  -0.3673048 -0.1408344
## sample estimates:
## mean in group capillary    mean in group venous 
##              -0.1224289               0.1316407
t.test(Tmax ~ site, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  Tmax by site
## t = -1.2786, df = 93.904, p-value = 0.2042
## alternative hypothesis: true difference in means between group capillary and group venous is not equal to 0
## 95 percent confidence interval:
##  -16.571704   3.589098
## sample estimates:
## mean in group capillary    mean in group venous 
##                62.70968                69.20098
t.test(Beta ~ site, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  Beta by site
## t = -0.18184, df = 39.468, p-value = 0.8566
## alternative hypothesis: true difference in means between group capillary and group venous is not equal to 0
## 95 percent confidence interval:
##  -0.0002730811  0.0002280155
## sample estimates:
## mean in group capillary    mean in group venous 
##             0.002169623             0.002192156
t.test(C_0_0_order ~ site, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  C_0_0_order by site
## t = 4.225, df = 37.009, p-value = 0.0001495
## alternative hypothesis: true difference in means between group capillary and group venous is not equal to 0
## 95 percent confidence interval:
##  0.09480385 0.26952408
## sample estimates:
## mean in group capillary    mean in group venous 
##               0.9811502               0.7989862
t.test(V_d_0_order ~ site, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  V_d_0_order by site
## t = 1.5073, df = 46.389, p-value = 0.1385
## alternative hypothesis: true difference in means between group capillary and group venous is not equal to 0
## 95 percent confidence interval:
##  -0.009793554  0.068237153
## sample estimates:
## mean in group capillary    mean in group venous 
##               0.6772378               0.6480160

Проверяем гипотезу о различиях групп по категориям route и sex.

t.test(Beta ~ route, data = order_0_df) 
## 
##  Welch Two Sample t-test
## 
## data:  Beta by route
## t = -3.952, df = 22.053, p-value = 0.0006754
## alternative hypothesis: true difference in means between group IV and group PO is not equal to 0
## 95 percent confidence interval:
##  -0.0007806703 -0.0002433704
## sample estimates:
## mean in group IV mean in group PO 
##      0.001761587      0.002273607
t.test(Beta ~ sex, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  Beta by sex
## t = 4.5937, df = 4.4652, p-value = 0.007747
## alternative hypothesis: true difference in means between group F and group M is not equal to 0
## 95 percent confidence interval:
##  0.0003360822 0.0012656766
## sample estimates:
## mean in group F mean in group M 
##     0.002982604     0.002181725
t.test(V_d_0_order ~ route, data = order_0_df) 
## 
##  Welch Two Sample t-test
## 
## data:  V_d_0_order by route
## t = -4.1909, df = 29.494, p-value = 0.0002314
## alternative hypothesis: true difference in means between group IV and group PO is not equal to 0
## 95 percent confidence interval:
##  -0.10884915 -0.03748701
## sample estimates:
## mean in group IV mean in group PO 
##        0.6074394        0.6806074
t.test(V_d_0_order ~ sex, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  V_d_0_order by sex
## t = -3.2625, df = 4.6626, p-value = 0.02478
## alternative hypothesis: true difference in means between group F and group M is not equal to 0
## 95 percent confidence interval:
##  -0.17872778 -0.01926724
## sample estimates:
## mean in group F mean in group M 
##       0.5752923       0.6742898
t.test(log(AUC) ~ route, data = order_0_df) 
## 
##  Welch Two Sample t-test
## 
## data:  log(AUC) by route
## t = -7.8695, df = 25.189, p-value = 3.004e-08
## alternative hypothesis: true difference in means between group IV and group PO is not equal to 0
## 95 percent confidence interval:
##  -0.7934900 -0.4644088
## sample estimates:
## mean in group IV mean in group PO 
##         4.545742         5.174692
t.test(log(AUC) ~ sex, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  log(AUC) by sex
## t = -4.0071, df = 4.3155, p-value = 0.01379
## alternative hypothesis: true difference in means between group F and group M is not equal to 0
## 95 percent confidence interval:
##  -1.1037583 -0.2154553
## sample estimates:
## mean in group F mean in group M 
##        4.564367        5.223974
t.test(Cmax ~ route, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  Cmax by route
## t = 7.9694, df = 80.102, p-value = 9.216e-12
## alternative hypothesis: true difference in means between group IV and group PO is not equal to 0
## 95 percent confidence interval:
##  0.3849115 0.6411207
## sample estimates:
## mean in group IV mean in group PO 
##        1.3830588        0.8700427
t.test(Cmax ~ sex, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  Cmax by sex
## t = -5.4861, df = 5.6395, p-value = 0.001876
## alternative hypothesis: true difference in means between group F and group M is not equal to 0
## 95 percent confidence interval:
##  -0.7970139 -0.3000288
## sample estimates:
## mean in group F mean in group M 
##        0.668000        1.216521
t.test(Tmax ~ route, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  Tmax by route
## t = 2.5439, df = 24.323, p-value = 0.01772
## alternative hypothesis: true difference in means between group IV and group PO is not equal to 0
## 95 percent confidence interval:
##   3.588895 34.338455
## sample estimates:
## mean in group IV mean in group PO 
##         80.41667         61.45299
t.test(Tmax ~ sex, data = order_0_df)
## 
##  Welch Two Sample t-test
## 
## data:  Tmax by sex
## t = -0.032711, df = 4.5118, p-value = 0.9753
## alternative hypothesis: true difference in means between group F and group M is not equal to 0
## 95 percent confidence interval:
##  -43.19236  42.14162
## sample estimates:
## mean in group F mean in group M 
##        63.40000        63.92537

Результаты: Группы по способу введения различаются по всем фк параметрам. Группы по полу различаются по всем фк-параметрам кроме Tmax.